package com.yangjiangtao.listener;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
@WebListener
public class Listener implements HttpSessionListener {
    private static Integer number = 0;
    @Override
    public void sessionCreated(HttpSessionEvent se) {
        number++;
        se.getSession().getServletContext().setAttribute("number",number);
    }
    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
        number--;
        se.getSession().getServletContext().setAttribute("number",number);
    }

}
